import 'dart:io';

import 'package:json_annotation/json_annotation.dart';

class B2CPickBean {
  int id; //拣选单id
  String pickNo; //拣选单
  String oblpn;
  String iblpn;
  String location;
  int totalQty; //总数
  int completeQty; //完成数量
  String sku;
  int qty;
  int inventory;
  int isRt; //0非退件单 展示下拉  1退件单 不展示下拉
  bool isNoneLocation; //是否启用
  int priority; //优先级
  List<ChildPick> childPicks = new List();
  List<PickupPol3Category> pickDetails = new List();
  List<PickupPol3Category> nonePickDetails = new List();
  int chooseNum = 0; //0未选中 , 1部分选中 , 2全部选中
  bool isDown; //是否下拉
  int transportType; // 转运类型 0非转运 1转运
  String trackingCode;

  B2CPickBean({
    this.id,
    this.pickNo,
    this.oblpn,
    this.iblpn,
    this.location,
    this.totalQty,
    this.completeQty,
    this.sku,
    this.qty,
    this.inventory,
    this.isRt,
    this.isNoneLocation,
    this.priority,
    this.childPicks,
    this.pickDetails,
    this.nonePickDetails,
    this.chooseNum,
    this.isDown,
    this.transportType,
    this.trackingCode,
  });

  factory B2CPickBean.fromJson(Map<String, dynamic> json) {
    return B2CPickBean(
      id: json["id"],
      pickNo: json["pickNo"],
      oblpn: json["oblpn"],
      iblpn: json["iblpn"],
      location: json["location"],
      totalQty: json["totalQty"],
      completeQty: json["completeQty"],
      sku: json["sku"],
      qty: json["qty"],
      inventory: json["inventory"],
      isRt: json["isRt"],
      isNoneLocation: json["isNoneLocation"],
      priority: json["priority"],
      childPicks: json['childPicks'] == null ? null : (new List<dynamic>.from(json['childPicks']).map((userJson) => ChildPick.fromJson(userJson)).toList()),
      pickDetails: json['pickDetails'] == null ? null : (new List<dynamic>.from(json['pickDetails']).map((userJson) => PickupPol3Category.fromJson(userJson)).toList()),
      nonePickDetails: json['nonePickDetails'] == null ? null : (new List<dynamic>.from(json['nonePickDetails']).map((userJson) => PickupPol3Category.fromJson(userJson)).toList()),
      chooseNum: json["chooseNum"],
      isDown: json["isDown"],
      transportType: json["transportType"],
      trackingCode: json["trackingCode"],
    );
  }
//

}

class ChildPick {
  int id; //子拣选单id
  String pickNo; //子拣选单
  int totalQty; //子拣选单总数
  int completeQty; //子拣选单完成数量

  bool isEnable; //是否选中
  bool isChoose;

  ChildPick({
    this.id,
    this.pickNo,
    this.totalQty,
    this.completeQty,
    this.isEnable,
    this.isChoose,
  });

  factory ChildPick.fromJson(Map<String, dynamic> json) {
    return ChildPick(
      id: json["id"],
      pickNo: json["pickNo"],
      totalQty: json["totalQty"],
      completeQty: json["completeQty"],
      isEnable: json["isEnable"],
      isChoose: json["isChoose"],
    );
  }
//是否选中

}

class PickupPol3Category {
  String location; //库位
  int locationQty; //库位数量
  String sku; //sku
  int pendingTotalQty; //待拣货数量
  int pendingQty;
  int pickedQty; //已拣货数量
  int isInventory; //是否提示 Other pick lists for this SKU need to be completed before handling its "None Location" sub-pick list.
  List<Lpn> lpns;
  String transferLocation; //
  String title; //

  bool Click;

  List<PickLocationDetails> locations;

  PickupPol3Category({
    this.location,
    this.locationQty,
    this.sku,
    this.pendingTotalQty,
    this.pendingQty,
    this.pickedQty,
    this.isInventory,
    this.lpns,
    this.transferLocation,
    this.title,
    this.Click,
    this.locations,
  });

  factory PickupPol3Category.fromJson(Map<String, dynamic> json) {
    return PickupPol3Category(
      location: json["location"],
      locationQty: json["locationQty"],
      sku: json["sku"],
      pendingTotalQty: json["pendingTotalQty"],
      pendingQty: json["pendingQty"],
      pickedQty: json["pickedQty"],
      isInventory: json["isInventory"],
      lpns: json['lpns'] == null ? null : (new List<dynamic>.from(json['lpns']).map((userJson) => Lpn.fromJson(userJson)).toList()),
      transferLocation: json["transferLocation"],
      title: json["title"],
      Click: json["Click"],
      locations: json['locations'] == null ? null : (new List<dynamic>.from(json['locations']).map((userJson) => PickLocationDetails.fromJson(userJson)).toList()),
    );
  }
//

}

class PickLocationDetails {
  String location;
  List<Lpn> lpns;

  PickLocationDetails({
    this.location,
    this.lpns,
  });

  factory PickLocationDetails.fromJson(Map<String, dynamic> json) {
    return PickLocationDetails(
      location: json["location"],
      lpns: json['lpns'] == null ? null : (new List<dynamic>.from(json['lpns']).map((userJson) => Lpn.fromJson(userJson)).toList()),
    );
  }
//

}

class Lpn {
  String trackingCode; //trk
  String lpn; //lpn
  int inventory;

  Lpn({
    this.trackingCode,
    this.lpn,
    this.inventory,
  }); //lpn库存数量

  factory Lpn.fromJson(Map<String, dynamic> json) {
    return Lpn(
      trackingCode: json["trackingCode"],
      lpn: json["lpn"],
      inventory: json["inventory"],
    );
  }
}

class PickupPol3CategoryQr {
  String pickId;
  String ibLpn;
  List<int> pickChildIds = new List();

  Map<String, dynamic> toJson() {
    return {
      "pickId": this.pickId,
      "ibLpn": this.ibLpn,
      "pickChildIds": this.pickChildIds,
    };
  }
}

class PickObLpn {
  int pickId;
  String obLpn;

  Map<String, dynamic> toJson() {
    return {
      "pickId": this.pickId,
      "obLpn": this.obLpn,
    };
  }
}

class PickupPol3OBLPN {
  String lpn;
  int inventory;

  PickupPol3OBLPN({this.lpn, this.inventory});

  factory PickupPol3OBLPN.fromJson(Map<String, dynamic> json) {
    return PickupPol3OBLPN(
      lpn: json["lpn"],
      inventory: json["inventory"],
    );
  }
}

class LPNSKU {
  String ibLpn;
  String sku;

  LPNSKU({this.ibLpn, this.sku});

  factory LPNSKU.fromJson(Map<String, dynamic> json) {
    return LPNSKU(
      ibLpn: json["ibLpn"],
      sku: json["sku"],
    );
  }

  @override
  String toString() {
    return '$ibLpn}';
  }
}

class PickupPol3FeedbackQr {
  int pickId;
  String pickNo;
  String location;
  String abnormalType;
  String ibLpn;
  String sku;
  int missingSkuQty;

  Map<String, dynamic> toJson() {
    return {
      "pickId": this.pickId,
      "pickNo": this.pickNo,
      "location": this.location,
      "abnormalType": this.abnormalType,
      "ibLpn": this.ibLpn,
      "sku": this.sku,
      "missingSkuQty": this.missingSkuQty,
    };
  }
}

class PickupPol3Location {
  String location; //库位
  List<SkuList> skuList;

  PickupPol3Location({this.location, this.skuList});

  factory PickupPol3Location.fromJson(Map<String, dynamic> json) {
    return PickupPol3Location(
      location: json["location"],
      skuList: json['skuList'] == null ? null : (new List<dynamic>.from(json['skuList']).map((userJson) => SkuList.fromJson(userJson)).toList()),
    );
  }
//

}

class SkuList {
  String sku; //sku
  int pendingQty; //待拣货数量
  int pickedQty; //已拣货数量
  int inventoryQty; //库存数量
  String trackingCode;

  int amount; //待拣数量
  int inventory;

  SkuList({this.sku, this.pendingQty, this.pickedQty, this.inventoryQty, this.trackingCode, this.amount, this.inventory});

  factory SkuList.fromJson(Map<String, dynamic> json) {
    return SkuList(
      sku: json["sku"],
      pendingQty:json["pendingQty"],
      pickedQty: json["pickedQty"],
      inventoryQty: json["inventoryQty"],
      trackingCode: json["trackingCode"],
      amount: json["amount"],
      inventory: json["inventory"],
    );
  }
//库存数量



}

class SkuUpType {
  int warehousingDetailId;
  String barcode; //barcode
  String sku; //sku
  String upType = "CTN"; //上架方式
  bool isSmall; //true是小件
  SkuBaseRespVo skuBaseRespVo;

  SkuUpType({this.warehousingDetailId, this.barcode, this.sku, this.upType, this.isSmall, this.skuBaseRespVo});

  factory SkuUpType.fromJson(Map<String, dynamic> json) {
    return SkuUpType(
      warehousingDetailId: int.parse(json["warehousingDetailId"]),
      barcode: json["barcode"],
      sku: json["sku"],
      upType: json["upType"],
      isSmall: json["isSmall"].toLowerCase() == 'true',
      skuBaseRespVo: SkuBaseRespVo.fromJson(json["skuBaseRespVo"]),
    );
  }
//

}

class SkuBaseRespVo {
  double length;
  String lengthPhoto;
  double width;
  String widthPhoto;
  double height;
  String heightPhoto;
  double weight;
  String weightPhoto;
  List<String> damagePhotos = new List();

  SkuBaseRespVo({this.length, this.lengthPhoto, this.width, this.widthPhoto, this.height, this.heightPhoto, this.weight, this.weightPhoto, this.damagePhotos});

  factory SkuBaseRespVo.fromJson(Map<String, dynamic> json) {
    return SkuBaseRespVo(
      length: json["length"],
      lengthPhoto: json["lengthPhoto"],
      width: json["width"],
      widthPhoto: json["widthPhoto"],
      height: json["height"],
      heightPhoto: json["heightPhoto"],
      weight: json["weight"],
      weightPhoto: json["weightPhoto"],
      damagePhotos: json['damagePhotos'] == null ? null : new List<String>.from(json['damagePhotos']) as List<String>,
    );
  }
}

class PickLableQr {
  String pickup;
  String location;
  String lpn;
  String obLpn;
  String sku;
  int quantity = 1;

  Map<String, dynamic> toJson() {
    return {
      "pickup": this.pickup,
      "location": this.location,
      "lpn": this.lpn,
      "obLpn": this.obLpn,
      "sku": this.sku,
      "quantity": this.quantity,
    };
  }
}

class NewLabelBean {
  List<SkuList> pickUpLocationAndLpnRespVos;
  List<TempPickUpBean> pickDetailsRespVos;

  NewLabelBean({this.pickUpLocationAndLpnRespVos, this.pickDetailsRespVos});

  factory NewLabelBean.fromJson(Map<String, dynamic> json) {
    return NewLabelBean(
      pickUpLocationAndLpnRespVos: json['pickUpLocationAndLpnRespVos'] == null ? null : (new List<dynamic>.from(json['pickUpLocationAndLpnRespVos']).map((userJson) => SkuList.fromJson(userJson)).toList()),
      pickDetailsRespVos: json['pickDetailsRespVos'] == null ? null : (new List<dynamic>.from(json['pickDetailsRespVos']).map((userJson) => TempPickUpBean.fromJson(userJson)).toList()),
    );
  }

}


class TempPickUpBean {
  String location;
  List<PickSkuDetails> pickSkuDetails;

  TempPickUpBean({this.location, this.pickSkuDetails});

  factory TempPickUpBean.fromJson(Map<String, dynamic> json) {
    return TempPickUpBean(
      location: json["location"],
      pickSkuDetails: json['pickSkuDetails'] == null ? null : (new List<dynamic>.from(json['pickSkuDetails']).map((userJson) => PickSkuDetails.fromJson(userJson)).toList()),
    );
  }
//

}

class PickSkuDetails {
  String sku;
  int pendingTotalQty;
  int pendingQty;
  int pickedQty;
  List<Lpn> lpns;
  List<PickLocationDetails> pickLocationDetails;
  bool click;

  PickSkuDetails({this.sku, this.pendingTotalQty, this.pendingQty, this.pickedQty, this.lpns, this.pickLocationDetails, this.click});

  factory PickSkuDetails.fromJson(Map<String, dynamic> json) {
    return PickSkuDetails(
      sku: json["sku"],
      pendingTotalQty: json["pendingTotalQty"],
      pendingQty: json["pendingQty"],
      pickedQty: json["pickedQty"],
      lpns: json['lpns'] == null ? null : (new List<dynamic>.from(json['lpns']).map((userJson) => Lpn.fromJson(userJson)).toList()),
      pickLocationDetails: json['pickLocationDetails'] == null ? null : (new List<dynamic>.from(json['pickLocationDetails']).map((userJson) => PickLocationDetails.fromJson(userJson)).toList()),
      click: json["click"].toLowerCase() == 'true',
    );
  }
//

}
